package com.aizuda.boot.modules.business.comment.entity.dto;


import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import lombok.Data;

/**
 * @author yangshen
 * @version 1.0
 * @date 2025/5/23
 */
@Data
@Schema(description = "评论列表查询请求")
public class CommentReqDTO {
    @Schema(description = "合同id",required = true)
    private Integer contractId;

    protected static final String DESC = "desc";
    protected static final String ASC = "asc";

    @Min(value = 1, message = "页码需大于0")
    @Schema(description = "页码", example = "1")
    private int pageIndex = 1;

    @Min(value = 1, message = "分页数量需大于0")
    @Schema(description = "分页数量", example = "20")
    private int pageSize = 20;

    @Schema(description = "排序字段")
    private String orderBy;

    @Schema(description = "分页顺序,desc为降序，asc为升序")
    private String orderDirect;

    @Schema(hidden = true)
    public int getOffset() {
        return (pageIndex - 1) * pageSize;
    }
}
